#include <stdio.h>
#include <stdlib.h>


/* define the enums */

/* union to save some malloc'ing */
union value
{
	int i;
	double f;
	int r;
	enum opcode op;
};

/* simple struct for a token in the lexer */
struct token 
{
        union value v;
        enum valueType type;
        struct token *next;
        struct token *prev;
        int linenum;
};

struct tokenlist
{		
	/* current number of tokens in list */
	int tokenum;
	int errcheck;
	/* set head, tail, and current  to null for now */
	struct token *head;
	struct token *tail;
	struct token *current;	
};

/* define functions */

/* create a new list */
struct tokenlist * newlist();

/* creates a new int token */
struct token * new_int_token(int linev, union value intv);

/* creates a new float token */
struct token * new_float_token(int linev, union value fv);

/* creates a new register token */
struct token * new_reg_token(int linev, union value regv);

/* creates a new opcode token */
struct token * new_op_token(int linev, union value opv);

/* add a token to a list */
void add_token( struct token *toke, struct tokenlist *tlist);

/* kill a token and free its memory */
void kill_token (struct token *dead);

/* clear a list and releases memory */
void clear_list(struct tokenlist *tlist);

/* kill a list */
void kill_list(struct tokenlist *dead);
